<template>
  <div class="adminmodule mb-20">
    <div class="mycenter-in-user-two mycenter-in-user-list">
      <!--<p class="add-box-theme"><span></span>实时看板（教具管理）</p>-->
      <div class="add-box-theme-top">
        <p class="add-box-theme"><span></span>实时看板（教具管理）</p>
        <p class="add-btn-line" @click="addMudelLine"><i class="el-icon-plus"></i>添加教具</p>
      </div>
      <div class="mywork-list">
        <div class="mywork-list-line" @click="pathIndexFn()">
          <p class="mywork-list-line-l">
            <i class="iconfont icontushu1 colorfont-12"></i>
            <span>校园教具</span>
          </p>
          <p class="mywork-list-line-r">
            <span>总数：<em>{{statisticsData?statisticsData.tools.lend:0}}</em></span>
            <i class="el-icon-arrow-right"></i>
          </p>
        </div>
        <div class="mywork-list-line" @click="pathIndexFn()">
          <p class="mywork-list-line-l">
            <i class="iconfont icontushu1 colorfont-12"></i>
            <span>在库教具</span>
          </p>
          <p class="mywork-list-line-r">
            <span>总数：<em>{{statisticsData?statisticsData.tools.in_library:0}}</em></span>
            <i class="el-icon-arrow-right"></i>
          </p>
        </div>
        <div class="mywork-list-line" @click="pathIndexFn()">
          <p class="mywork-list-line-l">
            <i class="iconfont icontushu1 colorfont-12"></i>
            <span>在借教具</span>
          </p>
          <p class="mywork-list-line-r">
            <span>总数：<em>{{statisticsData?statisticsData.tools.lend:0}}</em></span>
            <i class="el-icon-arrow-right"></i>
          </p>
        </div>
        <div class="mywork-list-line" @click="pathIndexFn()">
          <p class="mywork-list-line-l">
            <i class="iconfont icontushu1 colorfont-12"></i>
            <span>核销教具</span>
          </p>
          <p class="mywork-list-line-r">
            <span>总数：<em>{{statisticsData?statisticsData.tools.scrap:0}}</em></span>
            <i class="el-icon-arrow-right"></i>
          </p>
        </div>
      </div>
    </div>
    <div class="adminmodule-c">
      <div class="adminmodule-c-tab">
        <span class="active">待处理审核（{{tabNumer}}）</span>
        <!--<span>超时书籍（10）</span>-->
      </div>
      <div class="adminmodule-c-body">
        <div class="adminmodule-c-body-title">
          <span class="adminmodule-c-t">申请教具</span>
          <span class="adminmodule-c-t">申请人</span>
          <span class="adminmodule-c-t">申请时间</span>
          <!--<span class="adminmodule-c-t">操作</span>-->
        </div>
        <div class="adminmodule-c-body-list" v-for="(item,index) in arryList"  v-if="index<4" @click="applyBook">
          <span class="adminmodule-c-l">{{item.tools.name}}</span>
          <span class="adminmodule-c-l">{{item.user.realname}}</span>
          <span class="adminmodule-c-l">{{item.create_time}}</span>
        </div>
        <div class="adminmodule-c-body-more"><span @click="applyBook">查看更多<i class="el-icon-d-arrow-right"></i></span></div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    props: ['statisticsData'],
    name: 'powerBook',
    data () {
      return {
        editForm: {
          name: '', // 名称
          p: '',
          is_examine: 0
        }, // 编辑界面数据
        arryList: [], // 数据列表
        tabNumer: 0
      }
    },
    created () {
      this.InitFn()
    },
    methods: {
      // 初始化
      InitFn () {
        this.$fetch(this.api.tools_apply_index, this.editForm).then((response) => {
          if (response.code === 0) {
            // create_time
            for (let i in response.list.data) {
              response.list.data[i].create_time = response.list.data[i].create_time.split(' ')[0]
              if (this.editForm.status !== 0) {
                response.list.data[i].examine_time = response.list.data[i].examine_time.split(' ')[0]
              }
              if (this.editForm.status === 2) {
                response.list.data[i].actual_return_time = response.list.data[i].actual_return_time.split(' ')[0]
              }
            }
            this.arryList = response.list.data
            this.tabNumer = response.list.total
          } else {
          }
        }).catch((err) => {
          console.log(err)
        })
      },
      pathIndexFn () {
        this.$router.push('/teaching')
      },
      applyBook () {
        this.$router.push('/getlist')
      },
      addMudelLine () {
        this.$router.push('/teachingdetail')
      }
    }
  }
</script>

<style scoped>

</style>
